home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD ROM Paradise Collection 4
/
CD ROM Paradise Collection 4 1995 Nov.iso
/
program
/
swagg_m.zip
/
MISC.SWG
/
0126_How to pass functions as parameters.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1995-02-28
|
648b
|
38 lines
program FuncTest;
{
An example of how to pass functions as parameters to
another procedure (csc).
This program comes with no guarrentees and no support.
}
type
TBoolFunc = function: Boolean;
TRealFunc = function(X: Real): Real;
var
RealFunc: TRealFunc;
BoolFunc: TBoolFunc;
function Con1: Boolean; Far;
begin
Con1 := True;
end;
function Con2(X : Real): Real; far;
begin
Con2 := X * X;
end;
procedure Sambo(AFunc: TRealFunc);
begin
WriteLn(AFunc(4):2:2);
end;
begin
BoolFunc := Con1;
RealFunc := Con2;
WriteLn(BoolFunc);
Sambo(RealFunc);
end.